import pymysql

def get_connection():
    conn = pymysql.connect(
        user='root',
        password='123456',
        # 为了让window认识master主机，我们需要配置hosts映射
        # C:\Windows\System32\drivers\etc\hosts
        host='master',
        database='car_family',
        port=3306,
        charset='utf8'
    )

    return conn